cmake_minimum_required(VERSION 3.20)

project("QtMultiPart")

set(CMAKE_AUTOUIC ON)
set(CMAKE_AUTOMOC ON)
SET(CMAKE_AUTORCC ON)

#设置qt的cmake环境变量，从系统变量中获取qt的安装路径
#set(CMAKE_PREFIX_PATH $ENV{QT_DIR})
find_package(Qt5 COMPONENTS NetWork Core Widgets REQUIRED)

# 设置静态库输出目录
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_CURRENT_LIST_DIR}/bin)
 
# 设置动态库输出目录
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_CURRENT_LIST_DIR}/bin)
 
# 设置可执行文件输出目录
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_LIST_DIR}/bin)
#变量在后
aux_source_directory(${CMAKE_CURRENT_LIST_DIR}/src SOURCEFILES)
#变量在前
file(GLOB HEDADS ${CMAKE_CURRENT_LIST_DIR}/src/*.h)
file(GLOB UIFILES ${CMAKE_CURRENT_LIST_DIR}/src/*.ui)

add_executable(${PROJECT_NAME}
                ${SOURCEFILES}
                ${HEADERS}
                ${UIFILES} 
                )

target_link_libraries (${PROJECT_NAME} PRIVATE 
                Qt5::Core
                Qt5::Network
                Qt5::Widgets)

set_target_properties(${PROJECT_NAME} PROPERTIES WIN32_EXECUTABLE TRUE)

